import Vue from 'vue'
import { Dialog } from 'vant';
import axios from 'axios'
axios.defaults.baseURL = 'https://web03.cn'; //'https://localhost' //
axios.defaults.withCredentials = true; //是否带cookie
axios.defaults.headers['Content-Type'] = 'application/json';
axios.interceptors.response.use(response => {
  if (response.status !== 200) {
    Dialog.alert({
      title: '错误代码' + response.status,
      message: '请求失败 未知错误 •﹏•'
    })
  }else if (response.data === -3){
    Dialog.alert({
      title: '权限不足',
      message: '只能看，不能动，大坏蛋(◔◡◔)'
    });
    return Promise.reject()
  }
  return response
}, err => {
  Dialog.alert({
    title: '请求异常',
    message: '请求失败 未知错误 •﹏•'
  })
  return Promise.reject(err)
});
import request from './request'
Vue.prototype.request = request
